package com.lzy.utils;

import java.util.Collection;
import java.util.List;

/**
 * @author lyw
 * @Date 2023/2/1-下午4:26
 */
public class StringUtil {

  private StringUtil() {}

  public static boolean isNotEmpty(String s) {
    return !isEmpty(s) && s != null;
  }

  public static boolean isNotEmpty(Object[] s) {
    return !isNull(s) && (s.length > 0);
  }

  public static boolean isNotEmpty(Collection<?> s) {
    return !isNull(s) && (s.size() > 0);
  }

  /**
   * * 判断一个对象是否为空
   *
   * @param object Object
   * @return true：为空 false：非空
   */
  public static boolean isNotNull(Object object)
  {
    return !isNull(object);
  }

  /**
   * * 判断一个对象是否为空
   *
   * @param object Object
   * @return true：为空 false：非空
   */
  public static boolean isNull(Object object)
  {
    return object == null;
  }

  public static boolean isNull(Collection<?> coll)
  {
    return coll == null || coll.size() == 0;
  }

  public static boolean isEmpty(String code) {
    return "".equals(code);
  }
}
